import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import Router from './router/index'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import axios from 'axios'
//前置拦截器
axios.interceptors.request.use(config => {
    const adminToken = localStorage.getItem('adminToken');
    const userToken = localStorage.getItem('userToken');
  if (adminToken) {
    config.headers['Token'] = adminToken;
  } else if (userToken) {
      config.headers['Token'] = userToken;
    }
  return config;
}, error => {
  Promise.reject(error);
})

const app = createApp(App)
const pinia = createPinia()

app.use(pinia)
app.use(Router)
app.use(ElementPlus)

app.mount('#app')
